\documentclass[10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp}

\usepackage[utf8x]{inputenc}
\usepackage{pslatex}
\usepackage{gnuplot-lua-tikz}
\pagestyle{empty}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{\gpbboxborder}

\usepackage{pgfplots}
\usepgfplotslibrary{groupplots} % LATEX and plain TEX
\usepgfplotslibrary[groupplots] % ConTEXt
\usetikzlibrary{pgfplots.groupplots} % LATEX and plain TEX
\usetikzlibrary[pgfplots.groupplots] % ConTEXt
\pgfplotsset{group style={a=2,b=3}}
 \pgfplotsset{width=7cm,compat=1.3}


\begin{document}
\begin{tikzpicture}
\begin{loglogaxis}[
xlabel={Degrees of freedom},
ylabel={$L_2$ Error}
]
\addplot coordinates {
(5,8.312e-02)
(17,2.547e-02)
(49,7.407e-03)
(129,2.102e-03) (321,5.874e-04) (769,1.623e-04)
(1793,4.442e-05) (4097,1.207e-05) (9217,3.261e-06)
};
\addplot coordinates{
(7,8.472e-02)
(31,3.044e-02)
(111,1.022e-02)
(351,3.303e-03) (1023,1.039e-03) (2815,3.196e-04)
(7423,9.658e-05) (18943,2.873e-05) (47103,8.437e-06)
};
\addplot coordinates{
(9,7.881e-02)
(49,3.243e-02)
(209,1.232e-02)
(769,4.454e-03)
(2561,1.551e-03) (7937,5.236e-04)
(23297,1.723e-04) (65537,5.545e-05) (178177,1.751e-05)
};
\addplot coordinates{
(11,6.887e-02)
(71,3.177e-02)
(351,1.341e-02)
(1471,5.334e-03) (5503,2.027e-03)
(18943,7.415e-04)
(61183,2.628e-04) (187903,9.063e-05) (553983,3.053e-05)
};
\addplot coordinates{
(13,5.755e-02)
(97,2.925e-02)
(545,1.351e-02)
(2561,5.842e-03)
(10625,2.397e-03) (40193,9.414e-04)
(141569,3.564e-04) (471041,1.308e-04) (1496065,4.670e-05)
};
\legend{$d=2$,$d=3$,$d=4$,$d=5$,$d=6$}
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}
  \addplot+[id=parable,domain=-5:5]
  gnuplot{4*x**2 - 5}
  node[pin=180:{$4x^2-5$}]{};
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[
	view={120}{40},
	width=220pt,
	height=220pt,
	grid=major,
	z buffer=sort,
	xmin=-1,xmax=9,
	ymin=-1,ymax=9,
	zmin=-1,zmax=9,
	enlargelimits=upper,
	xtick={-1,1,...,19},
	ytick={-1,1,...,19},
	ztick={-1,1,...,19},
	xlabel={$l_1$},
	ylabel={$l_2$},
	zlabel={$l_3$},
	point meta={x+y+z+3},
	colormap={summap}{
		color=(black); color=(blue); 
		color=(black); color=(white) 
		color=(orange) color=(violet) 
		color=(red)
	},
	scatter/use mapped color={
		draw=mapped color,fill=mapped color!70},
	]
	% `pgfplots_scatter4.dat' contains a large sequence of
	% the form
	% l_0   l_1     l_2     
	% 1     6       -1      
	% -1    -1      -1      
	% 0     -1      -1      
	% -1    0       -1      
	% -1    -1      0       
	% 1     -1      -1      
	% 0     0       -1      
	% 0     -1      0       
	\addplot3[only marks,scatter,mark=cube*,mark size=7] 
		table {pgfplots_scatter4.dat};

\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{axis}
	\addplot3+[mesh,scatter,samples=10,domain=0:1] 
		{x*(1-x)*y*(1-y)};
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}%
   \begin{axis}[
      title=A title,
      ylabel style={overlay},
      yticklabel style={overlay},
      xlabel={$x$},
      ylabel={$y$},
      legend style={at={(0.5,0.97)},
         anchor=north,legend columns=-1},
      domain=-2:2
   ]
   \addplot {x^2};
   \addplot {x^3};
   \addplot {x^4};
   \legend{$x^2$,$x^3$,$x^4$}
   \end{axis}
\end{tikzpicture}%

\begin{tikzpicture}
\begin{loglogaxis}[xlabel=Cost,ylabel=Gain]
\addplot[color=red,mark=x] coordinates {
(10,100)
(20,150)
(40,225)
(80,340)
(160,510)
(320,765)
(640,1150)
};
\end{loglogaxis}
\end{tikzpicture}


\begin{tikzpicture}
\begin{axis}
\addplot coordinates {
(1,2.3)
(2,2.7)
(3,2.1)
(4,1.8)
(5,1.5)
(6,1.1)};
\end{axis}
\end{tikzpicture}


\begin{tikzpicture}
\begin{groupplot}
[group style={
group name=my plots,
group size=2 by 2,
%
x descriptions at=edge bottom,
y descriptions at=edge right,
horizontal sep=0.5cm,
vertical sep=0.5cm,
},
footnotesize,
width=4cm,
height=4cm,
%
xlabel=time $t$ / h,
ylabel=$c$ / mol/L,
]
\nextgroupplot
\addplot coordinates{(0,0) (1,2) (2,1)};
\nextgroupplot
\addplot coordinates{(0,0) (1,2) (2,1)};
\nextgroupplot
\addplot coordinates{(0,0) (1,2) (2,1)};
\nextgroupplot
\addplot coordinates{(0,0) (1,2) (2,1)};
\end{groupplot}
\end{tikzpicture}


% \newpage
% \begin{tikzpicture}[gnuplot]
% %% generated with GNUPLOT 4.5p0 (Lua 5.1; terminal rev. 99, script rev. 98)
% %% Tue 08 Mar 2011 06:53:41 AM BRT
% \gpsolidlines
% \gpcolor{color=gp lt color border}
% \gpsetlinetype{gp lt border}
% \gpsetlinewidth{1.00}
% \draw[gp path] (0.000,0.000)--(0.233,0.000);
% \draw[gp path] (9.000,0.000)--(8.767,0.000);
% \node[gp node right] at (-0.239,0.000) {0.00};
% \draw[gp path] (0.000,0.650)--(0.233,0.650);
% \draw[gp path] (9.000,0.650)--(8.767,0.650);
% \node[gp node right] at (-0.239,0.650) {0.02};
% \draw[gp path] (0.000,1.300)--(0.233,1.300);
% \draw[gp path] (9.000,1.300)--(8.767,1.300);
% \node[gp node right] at (-0.239,1.300) {0.04};
% \draw[gp path] (0.000,1.950)--(0.233,1.950);
% \draw[gp path] (9.000,1.950)--(8.767,1.950);
% \node[gp node right] at (-0.239,1.950) {0.06};
% \draw[gp path] (0.000,2.600)--(0.233,2.600);
% \draw[gp path] (9.000,2.600)--(8.767,2.600);
% \node[gp node right] at (-0.239,2.600) {0.08};
% \draw[gp path] (0.000,3.250)--(0.233,3.250);
% \draw[gp path] (9.000,3.250)--(8.767,3.250);
% \node[gp node right] at (-0.239,3.250) {0.10};
% \draw[gp path] (0.000,3.900)--(0.233,3.900);
% \draw[gp path] (9.000,3.900)--(8.767,3.900);
% \node[gp node right] at (-0.239,3.900) {0.12};
% \draw[gp path] (0.000,4.550)--(0.233,4.550);
% \draw[gp path] (9.000,4.550)--(8.767,4.550);
% \node[gp node right] at (-0.239,4.550) {0.14};
% \draw[gp path] (0.000,5.200)--(0.233,5.200);
% \draw[gp path] (9.000,5.200)--(8.767,5.200);
% \node[gp node right] at (-0.239,5.200) {0.15};
% \draw[gp path] (0.000,5.850)--(0.233,5.850);
% \draw[gp path] (9.000,5.850)--(8.767,5.850);
% \node[gp node right] at (-0.239,5.850) {0.17};
% \draw[gp path] (0.000,6.500)--(0.233,6.500);
% \draw[gp path] (9.000,6.500)--(8.767,6.500);
% \node[gp node right] at (-0.239,6.500) {0.19};
% \draw[gp path] (0.000,0.000)--(0.000,0.255);
% \draw[gp path] (0.000,6.500)--(0.000,6.245);
% \node[gp node center] at (0.000,-0.436) {-2};
% \draw[gp path] (1.059,0.000)--(1.059,0.255);
% \draw[gp path] (1.059,6.500)--(1.059,6.245);
% \node[gp node center] at (1.059,-0.436) { 0};
% \draw[gp path] (2.118,0.000)--(2.118,0.255);
% \draw[gp path] (2.118,6.500)--(2.118,6.245);
% \node[gp node center] at (2.118,-0.436) { 2};
% \draw[gp path] (3.176,0.000)--(3.176,0.255);
% \draw[gp path] (3.176,6.500)--(3.176,6.245);
% \node[gp node center] at (3.176,-0.436) { 4};
% \draw[gp path] (4.235,0.000)--(4.235,0.255);
% \draw[gp path] (4.235,6.500)--(4.235,6.245);
% \node[gp node center] at (4.235,-0.436) { 6};
% \draw[gp path] (5.294,0.000)--(5.294,0.255);
% \draw[gp path] (5.294,6.500)--(5.294,6.245);
% \node[gp node center] at (5.294,-0.436) { 8};
% \draw[gp path] (6.353,0.000)--(6.353,0.255);
% \draw[gp path] (6.353,6.500)--(6.353,6.245);
% \node[gp node center] at (6.353,-0.436) {10};
% \draw[gp path] (7.412,0.000)--(7.412,0.255);
% \draw[gp path] (7.412,6.500)--(7.412,6.245);
% \node[gp node center] at (7.412,-0.436) {12};
% \draw[gp path] (8.471,0.000)--(8.471,0.255);
% \draw[gp path] (8.471,6.500)--(8.471,6.245);
% \node[gp node center] at (8.471,-0.436) {14};
% \draw[gp path] (0.000,6.500)--(0.000,0.000)--(9.000,0.000)--(9.000,6.500)--cycle;
% \node[gp node center,rotate=-270] at (-1.631,3.250) {probability density \tikz[baseline]{\draw[yshift=.7ex,->](0,0)--(.7,0);}};
% \node[gp node center] at (4.499,-1.090) {$k, x$ \tikz[baseline]{\draw[yshift=.7ex,->](0,0)--(.7,0);}};
% \node[gp node center] at (4.499,7.154) {poisson PDF using normal approximation};
% \node[gp node left] at (3.970,0.650) {$\mu$};
% \node[gp node left] at (5.154,3.644) {$\sigma$};
% \draw[gp path](3.706,0.000)--(3.706,6.009);
% \draw[gp path](3.706,3.644)--(4.890,3.644);
% \gpcolor{color=gp lt color 0}
% \gpsetlinetype{gp lt plot 0}
% \draw[gp path] (0.000,0.000)--(0.022,0.000)--(0.067,0.000)--(0.113,0.000)--(0.158,0.000)%
%   --(0.204,0.000)--(0.249,0.000)--(0.294,0.000)--(0.340,0.000)--(0.385,0.000)--(0.429,0.000)%
%   --(0.474,0.000)--(0.520,0.000)--(0.565,0.000)--(0.611,0.000)--(0.656,0.000)--(0.701,0.000)%
%   --(0.747,0.000)--(0.792,0.000)--(0.792,0.227)--(0.836,0.227)--(0.881,0.227)--(0.927,0.227)%
%   --(0.972,0.227)--(1.018,0.227)--(1.063,0.227)--(1.108,0.227)--(1.154,0.227)--(1.199,0.227)%
%   --(1.243,0.227)--(1.288,0.227)--(1.334,0.227)--(1.334,1.134)--(1.379,1.134)--(1.425,1.134)%
%   --(1.470,1.134)--(1.515,1.134)--(1.561,1.134)--(1.606,1.134)--(1.650,1.134)--(1.696,1.134)%
%   --(1.741,1.134)--(1.786,1.134)--(1.832,1.134)--(1.832,2.836)--(1.877,2.836)--(1.922,2.836)%
%   --(1.968,2.836)--(2.013,2.836)--(2.057,2.836)--(2.103,2.836)--(2.148,2.836)--(2.193,2.836)%
%   --(2.239,2.836)--(2.284,2.836)--(2.329,2.836)--(2.375,2.836)--(2.375,4.727)--(2.420,4.727)%
%   --(2.464,4.727)--(2.510,4.727)--(2.555,4.727)--(2.600,4.727)--(2.646,4.727)--(2.691,4.727)%
%   --(2.736,4.727)--(2.782,4.727)--(2.827,4.727)--(2.871,4.727)--(2.917,4.727)--(2.917,5.909)%
%   --(2.962,5.909)--(3.007,5.909)--(3.053,5.909)--(3.098,5.909)--(3.143,5.909)--(3.189,5.909)%
%   --(3.234,5.909)--(3.278,5.909)--(3.324,5.909)--(3.369,5.909)--(3.414,5.909)--(3.460,5.909)%
%   --(3.505,5.909)--(3.550,5.909)--(3.596,5.909)--(3.641,5.909)--(3.685,5.909)--(3.731,5.909)%
%   --(3.776,5.909)--(3.821,5.909)--(3.867,5.909)--(3.912,5.909)--(3.958,5.909)--(3.958,4.924)%
%   --(4.003,4.924)--(4.048,4.924)--(4.092,4.924)--(4.138,4.924)--(4.183,4.924)--(4.228,4.924)%
%   --(4.274,4.924)--(4.319,4.924)--(4.365,4.924)--(4.410,4.924)--(4.455,4.924)--(4.501,4.924)%
%   --(4.501,3.518)--(4.545,3.518)--(4.590,3.518)--(4.635,3.518)--(4.681,3.518)--(4.726,3.518)%
%   --(4.772,3.518)--(4.817,3.518)--(4.862,3.518)--(4.908,3.518)--(4.952,3.518)--(4.997,3.518)%
%   --(5.042,3.518)--(5.042,2.198)--(5.088,2.198)--(5.133,2.198)--(5.179,2.198)--(5.224,2.198)%
%   --(5.269,2.198)--(5.315,2.198)--(5.359,2.198)--(5.404,2.198)--(5.450,2.198)--(5.495,2.198)%
%   --(5.540,2.198)--(5.540,1.221)--(5.586,1.221)--(5.631,1.221)--(5.676,1.221)--(5.722,1.221)%
%   --(5.766,1.221)--(5.811,1.221)--(5.857,1.221)--(5.902,1.221)--(5.947,1.221)--(5.993,1.221)%
%   --(6.038,1.221)--(6.083,1.221)--(6.083,0.610)--(6.129,0.610)--(6.173,0.610)--(6.218,0.610)%
%   --(6.264,0.610)--(6.309,0.610)--(6.354,0.610)--(6.400,0.610)--(6.445,0.610)--(6.490,0.610)%
%   --(6.536,0.610)--(6.580,0.610)--(6.625,0.610)--(6.625,0.278)--(6.671,0.278)--(6.716,0.278)%
%   --(6.761,0.278)--(6.807,0.278)--(6.852,0.278)--(6.897,0.278)--(6.943,0.278)--(6.987,0.278)%
%   --(7.032,0.278)--(7.078,0.278)--(7.123,0.278)--(7.168,0.278)--(7.168,0.116)--(7.214,0.116)%
%   --(7.259,0.116)--(7.304,0.116)--(7.350,0.116)--(7.394,0.116)--(7.439,0.116)--(7.485,0.116)%
%   --(7.530,0.116)--(7.575,0.116)--(7.621,0.116)--(7.666,0.116)--(7.666,0.044)--(7.712,0.044)%
%   --(7.757,0.044)--(7.801,0.044)--(7.846,0.044)--(7.892,0.044)--(7.937,0.044)--(7.982,0.044)%
%   --(8.028,0.044)--(8.073,0.044)--(8.119,0.044)--(8.164,0.044)--(8.208,0.044)--(8.208,0.016)%
%   --(8.253,0.016)--(8.299,0.016)--(8.344,0.016)--(8.389,0.016)--(8.435,0.016)--(8.480,0.016)%
%   --(8.526,0.016)--(8.571,0.016)--(8.615,0.016)--(8.660,0.016)--(8.706,0.016)--(8.751,0.016)%
%   --(8.751,0.006)--(8.796,0.006)--(8.842,0.006)--(8.887,0.006)--(8.933,0.006)--(8.978,0.006)%
%   --(9.000,0.006);
% \gpcolor{color=gp lt color 1}
% \gpsetlinetype{gp lt plot 1}
% \draw[gp path] (0.000,0.045)--(0.045,0.051)--(0.091,0.057)--(0.136,0.064)--(0.181,0.071)%
%   --(0.226,0.079)--(0.271,0.089)--(0.316,0.099)--(0.362,0.110)--(0.407,0.123)--(0.452,0.137)%
%   --(0.498,0.153)--(0.543,0.169)--(0.589,0.187)--(0.633,0.207)--(0.678,0.228)--(0.723,0.252)%
%   --(0.769,0.276)--(0.814,0.304)--(0.859,0.334)--(0.905,0.365)--(0.950,0.399)--(0.996,0.436)%
%   --(1.040,0.476)--(1.085,0.518)--(1.130,0.564)--(1.176,0.612)--(1.221,0.664)--(1.266,0.719)%
%   --(1.312,0.777)--(1.357,0.838)--(1.403,0.905)--(1.447,0.973)--(1.492,1.047)--(1.537,1.123)%
%   --(1.583,1.204)--(1.628,1.287)--(1.673,1.376)--(1.719,1.469)--(1.764,1.565)--(1.810,1.664)%
%   --(1.854,1.769)--(1.899,1.875)--(1.944,1.987)--(1.990,2.102)--(2.035,2.219)--(2.081,2.341)%
%   --(2.126,2.465)--(2.171,2.592)--(2.217,2.722)--(2.261,2.853)--(2.306,2.988)--(2.351,3.124)%
%   --(2.397,3.260)--(2.442,3.399)--(2.488,3.537)--(2.533,3.676)--(2.578,3.816)--(2.624,3.954)%
%   --(2.668,4.093)--(2.713,4.229)--(2.758,4.363)--(2.804,4.495)--(2.849,4.624)--(2.895,4.751)%
%   --(2.940,4.873)--(2.985,4.992)--(3.031,5.105)--(3.075,5.214)--(3.120,5.318)--(3.165,5.414)%
%   --(3.211,5.506)--(3.256,5.591)--(3.302,5.667)--(3.347,5.738)--(3.392,5.800)--(3.438,5.856)%
%   --(3.482,5.902)--(3.527,5.941)--(3.573,5.970)--(3.618,5.992)--(3.663,6.004)--(3.709,6.009)%
%   --(3.754,6.003)--(3.799,5.990)--(3.845,5.968)--(3.889,5.936)--(3.934,5.897)--(3.980,5.850)%
%   --(4.025,5.793)--(4.070,5.730)--(4.116,5.659)--(4.161,5.581)--(4.206,5.496)--(4.252,5.404)%
%   --(4.296,5.305)--(4.341,5.201)--(4.387,5.092)--(4.432,4.978)--(4.477,4.859)--(4.523,4.736)%
%   --(4.568,4.609)--(4.613,4.479)--(4.659,4.347)--(4.704,4.213)--(4.748,4.076)--(4.794,3.938)%
%   --(4.839,3.799)--(4.884,3.661)--(4.930,3.522)--(4.975,3.382)--(5.020,3.244)--(5.066,3.107)%
%   --(5.111,2.972)--(5.155,2.838)--(5.201,2.706)--(5.246,2.577)--(5.291,2.450)--(5.337,2.327)%
%   --(5.382,2.205)--(5.427,2.087)--(5.473,1.974)--(5.518,1.862)--(5.562,1.756)--(5.608,1.653)%
%   --(5.653,1.553)--(5.698,1.457)--(5.744,1.365)--(5.789,1.277)--(5.835,1.194)--(5.880,1.113)%
%   --(5.925,1.038)--(5.969,0.964)--(6.015,0.896)--(6.060,0.831)--(6.105,0.770)--(6.151,0.712)%
%   --(6.196,0.657)--(6.242,0.606)--(6.287,0.558)--(6.332,0.513)--(6.376,0.472)--(6.422,0.432)%
%   --(6.467,0.395)--(6.512,0.361)--(6.558,0.330)--(6.603,0.300)--(6.649,0.273)--(6.694,0.249)%
%   --(6.739,0.225)--(6.783,0.204)--(6.829,0.186)--(6.874,0.167)--(6.919,0.150)--(6.965,0.136)%
%   --(7.010,0.122)--(7.056,0.110)--(7.101,0.099)--(7.146,0.088)--(7.190,0.079)--(7.236,0.071)%
%   --(7.281,0.062)--(7.327,0.055)--(7.372,0.050)--(7.417,0.044)--(7.463,0.040)--(7.508,0.034)%
%   --(7.553,0.031)--(7.597,0.027)--(7.643,0.024)--(7.688,0.021)--(7.734,0.018)--(7.779,0.016)%
%   --(7.824,0.014)--(7.870,0.013)--(7.915,0.011)--(7.960,0.010)--(8.004,0.008)--(8.050,0.007)%
%   --(8.095,0.006)--(8.141,0.006)--(8.186,0.004)--(8.231,0.004)--(8.277,0.003)--(8.322,0.003)%
%   --(8.367,0.003)--(8.411,0.003)--(8.457,0.001)--(8.502,0.001)--(8.548,0.001)--(8.593,0.001)%
%   --(8.638,0.001)--(8.684,0.001)--(8.729,0.001)--(8.774,0.000)--(8.819,0.000)--(8.864,0.000)%
%   --(8.909,0.000)--(8.955,0.000)--(9.000,0.000);
% \gpcolor{color=gp lt color border}
% \gpsetlinetype{gp lt border}
% \draw[gp path] (0.000,6.500)--(0.000,0.000)--(9.000,0.000)--(9.000,6.500)--cycle;
% %% coordinates of the plot area
% \gpdefrectangularnode{gp plot 1}{\pgfpoint{0.000cm}{0.000cm}}{\pgfpoint{9.000cm}{6.500cm}}
% \end{tikzpicture}
% %% gnuplot variables
\end{document}
